import 'package:flutter/material.dart';
import 'package:xindong/common/xindong_sezhi.dart';
import 'package:xindong/widgets/common/xindong_tab_indicator.dart';

/// 选项栏
class XinDongSongLiTabBar extends StatelessWidget {
  final List<Widget> tabs;
  final TabController? controller;
  final Function() onTapBackpack;
  static Color normalColor = Colors.white.withOpacity(0.5);

  const XinDongSongLiTabBar({Key? key, required this.tabs, required this.controller, required this.onTapBackpack})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      height: 40,
      child: Row(
        children: [
          Expanded(
            child: TabBar(
              controller: controller,
              isScrollable: true,
              indicator: const XinDongTabIndicator(color: DZColors.mainColor),
              labelColor: DZColors.mainColor,
              unselectedLabelColor: normalColor,
              labelStyle: const TextStyle(fontSize: 16, fontWeight: FontWeight.normal, height: 1.2),
              unselectedLabelStyle: const TextStyle(fontSize: 16, fontWeight: FontWeight.normal, height: 1.2),
              tabs: tabs,
            ),
          ),
          GestureDetector(
            onTap: onTapBackpack,
            behavior: HitTestBehavior.opaque,
            child: Container(
              padding: const EdgeInsets.only(left: 16, right: 16),
              alignment: Alignment.center,
              child: const Row(
                mainAxisSize: MainAxisSize.min,
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  // Text(
                  //   "卡包",
                  //   style:
                  //       TextStyle(fontSize: 16, fontWeight: FontWeight.normal, color: DZColors.mainColor, height: 1.2),
                  // ),
                ],
              ),
            ),
          ),
        ],
      ),
    );
  }
}
